﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;              //命名空间
using System.Data.SqlClient;    //数据库头文件
using System.Data.Sql;         //数据库头文件
using DATA_operate_;          //自定义数据库操作类引用
using System.IO;

public partial class design_page_teacher_Default : System.Web.UI.Page
{
    DATA_operate data_operate_in_student_info = new DATA_operate();   //创建数据库操作类对象
   

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            string sql_id = "select * from _student ";
            data_operate_in_student_info.Data_bind(sql_id, GridView_show_student_info, "_Sid");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if(TextBox1.Text=="")
        {
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "right", "window.alert('保存成功');", true);

        }
     
            switch (DropDownList1.SelectedItem.Text)
            {
                case "根据学生ID查询":
                    string sql_studentid = "select * from _student where _Sid = '"+TextBox1.Text+"'";
                    data_operate_in_student_info.Data_bind(sql_studentid, GridView_show_student_info, "_Sid");
                    break;
                case "根据学生姓名查询":
                     string sql_studentname = "select * from _student where _Sname like '%"+TextBox1.Text+"%'";
                     data_operate_in_student_info.Data_bind(sql_studentname, GridView_show_student_info, "_Sid");
                    break;
                case "根据学生班级查询":
                     string sql_classid = "select * from _student where _SCid = '"+TextBox1.Text+"'";
                     data_operate_in_student_info.Data_bind(sql_classid, GridView_show_student_info, "_Sid");
                    break;
            }
      
       
    }
    protected void grid_pageindexchanging(object sender, GridViewPageEventArgs e)
    {
        string sql_id = "select * from _student ";
        data_operate_in_student_info.Data_bind(sql_id, GridView_show_student_info, "_Sid");
    }
}